package com.zichuan;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * @author zichuan
 * @version 1.0
 * @Package : com.zichuan
 * @Description : TODO
 * @Create on : 2025/2/20 12:23
 */
public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int a = in.nextInt();
            int count = 0;
            while (a>1){
                if (a == 2){
                    count +=1;
                    break;
                }
                int qishui = a / 3;
                count += qishui;
                a = qishui + a % 3;
            }
            System.out.println(count);
        }
    }

    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) { // 注意 while 处理多个 case
            //String s = in.next();
            int num = in.nextInt();
            //用于存储所有的奇数
            ArrayList<Integer> odds=new ArrayList<>();
            //用于存储所有的偶数
            ArrayList<Integer> evens=new ArrayList<>();
            while (num>0){
                int b = in.nextInt();
                //将奇数添加到odds
                if(b%2==1){
                    odds.add(b);
                }
                //将偶数添加到evens
                if(b%2==0){
                    evens.add(b);
                }
                num--;
            }
            //下标对应已经匹配的偶数的下标，值对应这个偶数的伴侣
            int[] matcheven=new int[evens.size()];
            //记录伴侣的对数
            int count=0;
            for(int j=0;j<odds.size();j++){
                //用于标记对应的偶数是否查找过
                boolean[] v=new boolean[evens.size()];
                //如果匹配上，则计数加1
                if(find(odds.get(j),matcheven,evens,v)){
                    count++;
                }
            }
            System.out.println(count);
        }
    }

    /**
     *
     * @param integer  奇数
     * @param matcheven
     * @param evens
     * @param v
     * @return
     */
    private static boolean find(Integer integer, int[] matcheven, ArrayList<Integer> evens, boolean[] v) {
        for (int i = 0; i < evens.size(); i++) {
            if (isPrime(integer+evens.get(i)) && v[i]==false){
                v[i] = true;
                if(matcheven[i]==0||find(matcheven[i],matcheven,evens,v)){
                    matcheven[i]=integer;
                    return true;
                }
            }
        }
        return false;
    }

    private static boolean isPrime(int x){
        if(x==1) return false;
        for (int i = 2; i < Math.sqrt(x); i++) {
            if (x % i == 0){
                return false;
            }
        }
        return true;
    }
}
